import requestJSON from '@/utils/request'
import { requestNew } from '@/utils/request'
import request from '@/utils/request'

// 通用广告api
export async function getAdList() {
  const res = await requestNew({
    url: '/order/pay/result/ad',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get'
  })
  return res
}

// n件n元 购物车结算
export async function nPieceSettle(value) {
  const res = await requestJSON({
    url: '/order',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: value || {}
  })
  return res
}

// n件n元 结算接口
export async function nPieceOrderCount(params) {
  const res = await requestJSON({
    url: '/order/settle',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: params || {}
  })
  return res
}

// n件n元 物料获取接口
export async function getGoodsList(id) {
  const res = await requestJSON({
    url: '/promotion/' + id,
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get'
  })
  return res
}

// 38新接口
// 查询用户38元佣金礼包总收益
export async function getNewTotalReward(val) {
  const res = await requestJSON({
    url: '/api/commission/v1/open/UserCommission/getSangiftTotalCommission',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: val || {}
  })
  return res
}
// 查询用户38元佣金礼包收益详细列表
export async function getNewRewardDetail(val) {
  const res = await requestJSON({
    url: '/api/commission/v1/open/UserCommission/listSangiftByUserId',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: val || {}
  })
  return res
}

// 38元接口
// 38元 任务达标情况接口
export async function getTaskProgress(val) {
  const res = await requestJSON({
    url: '/gift/getGiftTaskCondition',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params: val || {}
  })
  return res
}
// 38元 拉新人数列表接口
export async function getNewCustomer(val) {
  const res = await requestJSON({
    url: '/gift/getNewNumber',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: val || {}
  })
  return res
}
// 38元 礼包数列表接口
export async function getPackage(val) {
  const res = await requestJSON({
    url: '/gift/getGiftNumberList',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: val || {}
  })
  return res
}

// 升级vip
export async function getVipUrl(val) {
  const res = await request({
    url: '/upgrade-benefit/vip',
    method: 'get',
    params: val || {}
  })
  return res
}

// 转盘抽奖
// 根据抽奖活动id获取抽奖活动信息
export async function getRotaryBaseInfo(val) {
  const res = await requestJSON({
    url: '/lottery/activity/get',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params: val || {}
  })
  return res
}

// 根据抽奖活动id进行抽奖
export async function getRotaryResult(val) {
  const res = await requestJSON({
    url: '/lottery/user/lucky',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params: val || {}
  })
  return res
}

// 根据抽奖活动id获取中奖抽奖记录
export async function getRotaryRecords(val) {
  const res = await requestJSON({
    url: '/lottery/activity/record',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params: val || {}
  })
  return res
}

// 团购活动
// 拼团活动详情
export async function getGroupBuyBase(val) {
  // val detail: {groupBuyingId: 1}
  const res = await requestNew({
    url: '/groupbuying/groupBuyingDetail',
    method: 'get',
    params: val || {}
  })
  return res
}

// 拼团活动页面分页查询
export async function getGroupBuyPages(val) {
  // val detail: {pageNo: 1, pageSize: 10}
  const res = await requestNew({
    url: '/groupbuying/groupBuyingList',
    method: 'get',
    params: val || {}
  })
  return res
}

// 拼团- 分类和广告
export async function getBannerAndCategory(val) {
  const res = await request({
    url: '/goods/groupbuy/banner',
    method: 'post',
    data: val || {}
  })
  return res
}

// 商品详情页的团详情
export async function getGroupBase(val) {
  // val detail: {groupId: 1}
  const res = await requestNew({
    url: '/groupbuying/groupDetailInfo',
    method: 'get',
    params: val || {}
  })
  return res
}

// 查看更多的团分页查询
export async function getGroupPages(val) {
  // val detail: {groupBuyingId:1, pageNo: 1, pageSize: 10}
  const res = await requestNew({
    url: '/groupbuying/groupList',
    method: 'get',
    params: val || {}
  })
  return res
}

// 团长拼团活动进度详情
export async function getHeadGroupBuyDetail(val) {
  // val detail: {groupBuyingId:1, groupId: 1}
  const res = await requestNew({
    url: '/groupbuying/headGroupBuyingDetail',
    method: 'get',
    params: val || {}
  })
  return res
}

// 幼儿能力赛

// 获取排名
export async function getRankList(val) {
  const res = await requestJSON({
    url: '/schoolActivity/listUser',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params: val || {}
  })
  return res
}

// 获取官方微信
export async function getWeChatInfo(val) {
  const res = await requestJSON({
    url: '/schoolActivity/listWechatMsg',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: val || {}
  })
  return res
}

// 获取商品列表
export async function getKindGoodsList(val) {
  const res = await requestJSON({
    url: '/schoolActivity/listGoods',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: val || {}
  })
  return res
}

// 获取参与活动的用户信息
export async function getkindUserInfo(val) {
  const res = await requestJSON({
    url: '/schoolActivity/getUserMsg',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params: val || {}
  })
  return res
}

// 助力他人
export async function dohelpAction(val) {
  const res = await requestJSON({
    url: '/schoolActivity/helpOther',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: val || {}
  })
  return res
}

// 填写信息参加助力
export async function takePartInKind(val) {
  const res = await requestJSON({
    url: '/schoolActivity/register',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'post',
    data: val || {}
  })
  return res
}

// 助力登录
export async function kinderLogin(val) {
  const res = await requestJSON({
    url: '/schoolActivity/login/mobile',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params: val || {}
  })
  return res
}

// 时间获取
export async function getKinderTime(val) {
  const res = await requestJSON({
    url: '/schoolActivity/listActivityTime',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params: val || {}
  })
  return res
}

// 获取满减增商品专题
export async function getFullcutList(params = {}) {
  const res = await requestNew({
    url: '/groupbuying/fullcut/list',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params
  })
  return res
}

// 获取活动页一级类目接口
export async function getFullCutCategory(params = {}) {
  const res = await requestJSON({
    url: '/goods/groupbuy/banner',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params
  })
  return res
}

// 获取升级赚钱29.9礼包商品
export async function getUpgradeMakeMoneyMemberGoods(params = {}) {
  const res = await requestJSON({
    url: '/goods/getTwentyNineGift',
    headers: {
      'Content-Type': 'application/json'
    },
    method: 'get',
    params
  })
  return res
}
